<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">

<html lang="en">

<head>
  <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
  <title>LCOV - code analysis - /usr/include/boost/smart_ptr/detail/sp_counted_impl.hpp</title>
  <link rel="stylesheet" type="text/css" href="../../../../../gcov.css">
</head>

<body>

  <table width="100%" border=0 cellspacing=0 cellpadding=0>
    <tr><td class="title">LCOV - code coverage report</td></tr>
    <tr><td class="ruler"><img src="../../../../../glass.png" width=3 height=3 alt=""></td></tr>

    <tr>
      <td width="100%">
        <table cellpadding=1 border=0 width="100%">
          <tr>
            <td width="10%" class="headerItem">Current view:</td>
            <td width="35%" class="headerValue"><a href="../../../../../index.html">top level</a> - <a href="index.html">usr/include/boost/smart_ptr/detail</a> - sp_counted_impl.hpp<span style="font-size: 80%;"> (source / <a href="sp_counted_impl.hpp.func-sort-c.html">functions</a>)</span></td>
            <td width="5%"></td>
            <td width="15%"></td>
            <td width="10%" class="headerCovTableHead">Hit</td>
            <td width="10%" class="headerCovTableHead">Total</td>
            <td width="15%" class="headerCovTableHead">Coverage</td>
          </tr>
          <tr>
            <td class="headerItem">Test:</td>
            <td class="headerValue">code analysis</td>
            <td></td>
            <td class="headerItem">Lines:</td>
            <td class="headerCovTableEntry">10</td>
            <td class="headerCovTableEntry">18</td>
            <td class="headerCovTableEntryLo">55.6 %</td>
          </tr>
          <tr>
            <td class="headerItem">Date:</td>
            <td class="headerValue">2020-09-11 22:25:26</td>
            <td></td>
            <td class="headerItem">Functions:</td>
            <td class="headerCovTableEntry">48</td>
            <td class="headerCovTableEntry">795</td>
            <td class="headerCovTableEntryLo">6.0 %</td>
          </tr>
          <tr>
            <td class="headerItem">Legend:</td>
            <td class="headerValueLeg">            Lines:
            <span class="coverLegendCov">hit</span>
            <span class="coverLegendNoCov">not hit</span>
</td>
            <td></td>
          </tr>
          <tr><td><img src="../../../../../glass.png" width=3 height=3 alt=""></td></tr>
        </table>
      </td>
    </tr>

    <tr><td class="ruler"><img src="../../../../../glass.png" width=3 height=3 alt=""></td></tr>
  </table>

  <table cellpadding=0 cellspacing=0 border=0>
    <tr>
      <td><br></td>
    </tr>
    <tr>
      <td>
<pre class="sourceHeading">          Line data    Source code</pre>
<pre class="source">
<a name="1"><span class="lineNum">       1 </span>            : #ifndef BOOST_SMART_PTR_DETAIL_SP_COUNTED_IMPL_HPP_INCLUDED</a>
<span class="lineNum">       2 </span>            : #define BOOST_SMART_PTR_DETAIL_SP_COUNTED_IMPL_HPP_INCLUDED
<span class="lineNum">       3 </span>            : 
<span class="lineNum">       4 </span>            : // MS compatible compilers support #pragma once
<span class="lineNum">       5 </span>            : 
<span class="lineNum">       6 </span>            : #if defined(_MSC_VER) &amp;&amp; (_MSC_VER &gt;= 1020)
<span class="lineNum">       7 </span>            : # pragma once
<span class="lineNum">       8 </span>            : #endif
<span class="lineNum">       9 </span>            : 
<span class="lineNum">      10 </span>            : //
<span class="lineNum">      11 </span>            : //  detail/sp_counted_impl.hpp
<span class="lineNum">      12 </span>            : //
<span class="lineNum">      13 </span>            : //  Copyright (c) 2001, 2002, 2003 Peter Dimov and Multi Media Ltd.
<span class="lineNum">      14 </span>            : //  Copyright 2004-2005 Peter Dimov
<span class="lineNum">      15 </span>            : //
<span class="lineNum">      16 </span>            : // Distributed under the Boost Software License, Version 1.0. (See
<span class="lineNum">      17 </span>            : // accompanying file LICENSE_1_0.txt or copy at
<span class="lineNum">      18 </span>            : // http://www.boost.org/LICENSE_1_0.txt)
<span class="lineNum">      19 </span>            : //
<span class="lineNum">      20 </span>            : 
<span class="lineNum">      21 </span>            : #include &lt;boost/config.hpp&gt;
<span class="lineNum">      22 </span>            : 
<span class="lineNum">      23 </span>            : #if defined(BOOST_SP_USE_STD_ALLOCATOR) &amp;&amp; defined(BOOST_SP_USE_QUICK_ALLOCATOR)
<span class="lineNum">      24 </span>            : # error BOOST_SP_USE_STD_ALLOCATOR and BOOST_SP_USE_QUICK_ALLOCATOR are incompatible.
<span class="lineNum">      25 </span>            : #endif
<span class="lineNum">      26 </span>            : 
<span class="lineNum">      27 </span>            : #include &lt;boost/checked_delete.hpp&gt;
<span class="lineNum">      28 </span>            : #include &lt;boost/smart_ptr/detail/sp_counted_base.hpp&gt;
<span class="lineNum">      29 </span>            : 
<span class="lineNum">      30 </span>            : #if defined(BOOST_SP_USE_QUICK_ALLOCATOR)
<span class="lineNum">      31 </span>            : #include &lt;boost/smart_ptr/detail/quick_allocator.hpp&gt;
<span class="lineNum">      32 </span>            : #endif
<span class="lineNum">      33 </span>            : 
<span class="lineNum">      34 </span>            : #if defined(BOOST_SP_USE_STD_ALLOCATOR)
<span class="lineNum">      35 </span>            : #include &lt;memory&gt;           // std::allocator
<span class="lineNum">      36 </span>            : #endif
<span class="lineNum">      37 </span>            : 
<span class="lineNum">      38 </span>            : #include &lt;cstddef&gt;          // std::size_t
<span class="lineNum">      39 </span>            : 
<span class="lineNum">      40 </span>            : namespace boost
<span class="lineNum">      41 </span>            : {
<span class="lineNum">      42 </span>            : 
<span class="lineNum">      43 </span>            : #if defined(BOOST_SP_ENABLE_DEBUG_HOOKS)
<span class="lineNum">      44 </span>            : 
<span class="lineNum">      45 </span>            : void sp_scalar_constructor_hook( void * px, std::size_t size, void * pn );
<span class="lineNum">      46 </span>            : void sp_scalar_destructor_hook( void * px, std::size_t size, void * pn );
<span class="lineNum">      47 </span>            : 
<span class="lineNum">      48 </span>            : #endif
<span class="lineNum">      49 </span>            : 
<span class="lineNum">      50 </span>            : namespace detail
<a name="51"><span class="lineNum">      51 </span>            : {</a>
<span class="lineNum">      52 </span>            : 
<span class="lineNum">      53 </span><span class="lineCov">        462 : template&lt;class X&gt; class sp_counted_impl_p: public sp_counted_base</span>
<span class="lineNum">      54 </span>            : {
<span class="lineNum">      55 </span>            : private:
<span class="lineNum">      56 </span>            : 
<span class="lineNum">      57 </span>            :     X * px_;
<span class="lineNum">      58 </span>            : 
<span class="lineNum">      59 </span>            :     sp_counted_impl_p( sp_counted_impl_p const &amp; );
<span class="lineNum">      60 </span>            :     sp_counted_impl_p &amp; operator= ( sp_counted_impl_p const &amp; );
<span class="lineNum">      61 </span>            : 
<span class="lineNum">      62 </span>            :     typedef sp_counted_impl_p&lt;X&gt; this_type;
<span class="lineNum">      63 </span>            : 
<span class="lineNum">      64 </span>            : public:
<span class="lineNum">      65 </span>            : 
<span class="lineNum">      66 </span><span class="lineCov">        231 :     explicit sp_counted_impl_p( X * px ): px_( px )</span>
<span class="lineNum">      67 </span>            :     {
<span class="lineNum">      68 </span>            : #if defined(BOOST_SP_ENABLE_DEBUG_HOOKS)
<span class="lineNum">      69 </span>            :         boost::sp_scalar_constructor_hook( px, sizeof(X), this );
<span class="lineNum">      70 </span>            : #endif
<a name="71"><span class="lineNum">      71 </span>            :     }</a>
<span class="lineNum">      72 </span>            : 
<span class="lineNum">      73 </span><span class="lineCov">        231 :     virtual void dispose() // nothrow</span>
<span class="lineNum">      74 </span>            :     {
<span class="lineNum">      75 </span>            : #if defined(BOOST_SP_ENABLE_DEBUG_HOOKS)
<span class="lineNum">      76 </span>            :         boost::sp_scalar_destructor_hook( px_, sizeof(X), this );
<span class="lineNum">      77 </span>            : #endif
<span class="lineNum">      78 </span><span class="lineCov">        231 :         boost::checked_delete( px_ );</span>
<a name="79"><span class="lineNum">      79 </span><span class="lineCov">        231 :     }</span></a>
<span class="lineNum">      80 </span>            : 
<span class="lineNum">      81 </span><span class="lineNoCov">          0 :     virtual void * get_deleter( sp_typeinfo const &amp; )</span>
<span class="lineNum">      82 </span>            :     {
<span class="lineNum">      83 </span><span class="lineNoCov">          0 :         return 0;</span>
<a name="84"><span class="lineNum">      84 </span>            :     }</a>
<span class="lineNum">      85 </span>            : 
<span class="lineNum">      86 </span><span class="lineNoCov">          0 :     virtual void * get_untyped_deleter()</span>
<span class="lineNum">      87 </span>            :     {
<span class="lineNum">      88 </span><span class="lineNoCov">          0 :         return 0;</span>
<span class="lineNum">      89 </span>            :     }
<span class="lineNum">      90 </span>            : 
<span class="lineNum">      91 </span>            : #if defined(BOOST_SP_USE_STD_ALLOCATOR)
<span class="lineNum">      92 </span>            : 
<span class="lineNum">      93 </span>            :     void * operator new( std::size_t )
<span class="lineNum">      94 </span>            :     {
<span class="lineNum">      95 </span>            :         return std::allocator&lt;this_type&gt;().allocate( 1, static_cast&lt;this_type *&gt;(0) );
<span class="lineNum">      96 </span>            :     }
<span class="lineNum">      97 </span>            : 
<span class="lineNum">      98 </span>            :     void operator delete( void * p )
<span class="lineNum">      99 </span>            :     {
<span class="lineNum">     100 </span>            :         std::allocator&lt;this_type&gt;().deallocate( static_cast&lt;this_type *&gt;(p), 1 );
<span class="lineNum">     101 </span>            :     }
<span class="lineNum">     102 </span>            : 
<span class="lineNum">     103 </span>            : #endif
<span class="lineNum">     104 </span>            : 
<span class="lineNum">     105 </span>            : #if defined(BOOST_SP_USE_QUICK_ALLOCATOR)
<span class="lineNum">     106 </span>            : 
<span class="lineNum">     107 </span>            :     void * operator new( std::size_t )
<span class="lineNum">     108 </span>            :     {
<span class="lineNum">     109 </span>            :         return quick_allocator&lt;this_type&gt;::alloc();
<span class="lineNum">     110 </span>            :     }
<span class="lineNum">     111 </span>            : 
<span class="lineNum">     112 </span>            :     void operator delete( void * p )
<span class="lineNum">     113 </span>            :     {
<span class="lineNum">     114 </span>            :         quick_allocator&lt;this_type&gt;::dealloc( p );
<span class="lineNum">     115 </span>            :     }
<span class="lineNum">     116 </span>            : 
<span class="lineNum">     117 </span>            : #endif
<span class="lineNum">     118 </span>            : };
<span class="lineNum">     119 </span>            : 
<span class="lineNum">     120 </span>            : //
<span class="lineNum">     121 </span>            : // Borland's Codeguard trips up over the -Vx- option here:
<span class="lineNum">     122 </span>            : //
<span class="lineNum">     123 </span>            : #ifdef __CODEGUARD__
<span class="lineNum">     124 </span>            : # pragma option push -Vx-
<a name="125"><span class="lineNum">     125 </span>            : #endif</a>
<span class="lineNum">     126 </span>            : 
<span class="lineNum">     127 </span><span class="lineCov">          2 : template&lt;class P, class D&gt; class sp_counted_impl_pd: public sp_counted_base</span>
<span class="lineNum">     128 </span>            : {
<span class="lineNum">     129 </span>            : private:
<span class="lineNum">     130 </span>            : 
<span class="lineNum">     131 </span>            :     P ptr; // copy constructor must not throw
<span class="lineNum">     132 </span>            :     D del; // copy constructor must not throw
<span class="lineNum">     133 </span>            : 
<span class="lineNum">     134 </span>            :     sp_counted_impl_pd( sp_counted_impl_pd const &amp; );
<span class="lineNum">     135 </span>            :     sp_counted_impl_pd &amp; operator= ( sp_counted_impl_pd const &amp; );
<span class="lineNum">     136 </span>            : 
<span class="lineNum">     137 </span>            :     typedef sp_counted_impl_pd&lt;P, D&gt; this_type;
<span class="lineNum">     138 </span>            : 
<span class="lineNum">     139 </span>            : public:
<span class="lineNum">     140 </span>            : 
<span class="lineNum">     141 </span>            :     // pre: d(p) must not throw
<span class="lineNum">     142 </span>            : 
<span class="lineNum">     143 </span><span class="lineCov">          1 :     sp_counted_impl_pd( P p, D &amp; d ): ptr( p ), del( d )</span>
<span class="lineNum">     144 </span>            :     {
<span class="lineNum">     145 </span>            :     }
<span class="lineNum">     146 </span>            : 
<span class="lineNum">     147 </span>            :     sp_counted_impl_pd( P p ): ptr( p ), del()
<span class="lineNum">     148 </span>            :     {
<a name="149"><span class="lineNum">     149 </span>            :     }</a>
<span class="lineNum">     150 </span>            : 
<span class="lineNum">     151 </span><span class="lineCov">          1 :     virtual void dispose() // nothrow</span>
<span class="lineNum">     152 </span>            :     {
<span class="lineNum">     153 </span><span class="lineCov">          1 :         del( ptr );</span>
<a name="154"><span class="lineNum">     154 </span><span class="lineCov">          1 :     }</span></a>
<span class="lineNum">     155 </span>            : 
<span class="lineNum">     156 </span><span class="lineNoCov">          0 :     virtual void * get_deleter( sp_typeinfo const &amp; ti )</span>
<span class="lineNum">     157 </span>            :     {
<span class="lineNum">     158 </span><span class="lineNoCov">          0 :         return ti == BOOST_SP_TYPEID(D)? &amp;reinterpret_cast&lt;char&amp;&gt;( del ): 0;</span>
<a name="159"><span class="lineNum">     159 </span>            :     }</a>
<span class="lineNum">     160 </span>            : 
<span class="lineNum">     161 </span><span class="lineNoCov">          0 :     virtual void * get_untyped_deleter()</span>
<span class="lineNum">     162 </span>            :     {
<span class="lineNum">     163 </span><span class="lineNoCov">          0 :         return &amp;reinterpret_cast&lt;char&amp;&gt;( del );</span>
<span class="lineNum">     164 </span>            :     }
<span class="lineNum">     165 </span>            : 
<span class="lineNum">     166 </span>            : #if defined(BOOST_SP_USE_STD_ALLOCATOR)
<span class="lineNum">     167 </span>            : 
<span class="lineNum">     168 </span>            :     void * operator new( std::size_t )
<span class="lineNum">     169 </span>            :     {
<span class="lineNum">     170 </span>            :         return std::allocator&lt;this_type&gt;().allocate( 1, static_cast&lt;this_type *&gt;(0) );
<span class="lineNum">     171 </span>            :     }
<span class="lineNum">     172 </span>            : 
<span class="lineNum">     173 </span>            :     void operator delete( void * p )
<span class="lineNum">     174 </span>            :     {
<span class="lineNum">     175 </span>            :         std::allocator&lt;this_type&gt;().deallocate( static_cast&lt;this_type *&gt;(p), 1 );
<span class="lineNum">     176 </span>            :     }
<span class="lineNum">     177 </span>            : 
<span class="lineNum">     178 </span>            : #endif
<span class="lineNum">     179 </span>            : 
<span class="lineNum">     180 </span>            : #if defined(BOOST_SP_USE_QUICK_ALLOCATOR)
<span class="lineNum">     181 </span>            : 
<span class="lineNum">     182 </span>            :     void * operator new( std::size_t )
<span class="lineNum">     183 </span>            :     {
<span class="lineNum">     184 </span>            :         return quick_allocator&lt;this_type&gt;::alloc();
<span class="lineNum">     185 </span>            :     }
<span class="lineNum">     186 </span>            : 
<span class="lineNum">     187 </span>            :     void operator delete( void * p )
<span class="lineNum">     188 </span>            :     {
<span class="lineNum">     189 </span>            :         quick_allocator&lt;this_type&gt;::dealloc( p );
<span class="lineNum">     190 </span>            :     }
<span class="lineNum">     191 </span>            : 
<span class="lineNum">     192 </span>            : #endif
<span class="lineNum">     193 </span>            : };
<span class="lineNum">     194 </span>            : 
<span class="lineNum">     195 </span>            : template&lt;class P, class D, class A&gt; class sp_counted_impl_pda: public sp_counted_base
<span class="lineNum">     196 </span>            : {
<span class="lineNum">     197 </span>            : private:
<span class="lineNum">     198 </span>            : 
<span class="lineNum">     199 </span>            :     P p_; // copy constructor must not throw
<span class="lineNum">     200 </span>            :     D d_; // copy constructor must not throw
<span class="lineNum">     201 </span>            :     A a_; // copy constructor must not throw
<span class="lineNum">     202 </span>            : 
<span class="lineNum">     203 </span>            :     sp_counted_impl_pda( sp_counted_impl_pda const &amp; );
<span class="lineNum">     204 </span>            :     sp_counted_impl_pda &amp; operator= ( sp_counted_impl_pda const &amp; );
<span class="lineNum">     205 </span>            : 
<span class="lineNum">     206 </span>            :     typedef sp_counted_impl_pda&lt;P, D, A&gt; this_type;
<span class="lineNum">     207 </span>            : 
<span class="lineNum">     208 </span>            : public:
<span class="lineNum">     209 </span>            : 
<span class="lineNum">     210 </span>            :     // pre: d( p ) must not throw
<span class="lineNum">     211 </span>            : 
<span class="lineNum">     212 </span>            :     sp_counted_impl_pda( P p, D &amp; d, A a ): p_( p ), d_( d ), a_( a )
<span class="lineNum">     213 </span>            :     {
<span class="lineNum">     214 </span>            :     }
<span class="lineNum">     215 </span>            : 
<span class="lineNum">     216 </span>            :     sp_counted_impl_pda( P p, A a ): p_( p ), d_( a ), a_( a )
<span class="lineNum">     217 </span>            :     {
<span class="lineNum">     218 </span>            :     }
<span class="lineNum">     219 </span>            : 
<span class="lineNum">     220 </span>            :     virtual void dispose() // nothrow
<span class="lineNum">     221 </span>            :     {
<span class="lineNum">     222 </span>            :         d_( p_ );
<span class="lineNum">     223 </span>            :     }
<span class="lineNum">     224 </span>            : 
<span class="lineNum">     225 </span>            :     virtual void destroy() // nothrow
<span class="lineNum">     226 </span>            :     {
<span class="lineNum">     227 </span>            : #if !defined( BOOST_NO_CXX11_ALLOCATOR )
<span class="lineNum">     228 </span>            : 
<span class="lineNum">     229 </span>            :         typedef typename std::allocator_traits&lt;A&gt;::template rebind_alloc&lt; this_type &gt; A2;
<span class="lineNum">     230 </span>            : 
<span class="lineNum">     231 </span>            : #else
<span class="lineNum">     232 </span>            : 
<span class="lineNum">     233 </span>            :         typedef typename A::template rebind&lt; this_type &gt;::other A2;
<span class="lineNum">     234 </span>            : 
<span class="lineNum">     235 </span>            : #endif
<span class="lineNum">     236 </span>            : 
<span class="lineNum">     237 </span>            :         A2 a2( a_ );
<span class="lineNum">     238 </span>            : 
<span class="lineNum">     239 </span>            : #if !defined( BOOST_NO_CXX11_ALLOCATOR )
<span class="lineNum">     240 </span>            : 
<span class="lineNum">     241 </span>            :         std::allocator_traits&lt;A2&gt;::destroy( a2, this );
<span class="lineNum">     242 </span>            : 
<span class="lineNum">     243 </span>            : #else
<span class="lineNum">     244 </span>            : 
<span class="lineNum">     245 </span>            :         this-&gt;~this_type();
<span class="lineNum">     246 </span>            : 
<span class="lineNum">     247 </span>            : #endif
<span class="lineNum">     248 </span>            : 
<span class="lineNum">     249 </span>            :         a2.deallocate( this, 1 );
<span class="lineNum">     250 </span>            :     }
<span class="lineNum">     251 </span>            : 
<span class="lineNum">     252 </span>            :     virtual void * get_deleter( sp_typeinfo const &amp; ti )
<span class="lineNum">     253 </span>            :     {
<span class="lineNum">     254 </span>            :         return ti == BOOST_SP_TYPEID( D )? &amp;reinterpret_cast&lt;char&amp;&gt;( d_ ): 0;
<span class="lineNum">     255 </span>            :     }
<span class="lineNum">     256 </span>            : 
<span class="lineNum">     257 </span>            :     virtual void * get_untyped_deleter()
<span class="lineNum">     258 </span>            :     {
<span class="lineNum">     259 </span>            :         return &amp;reinterpret_cast&lt;char&amp;&gt;( d_ );
<span class="lineNum">     260 </span>            :     }
<span class="lineNum">     261 </span>            : };
<span class="lineNum">     262 </span>            : 
<span class="lineNum">     263 </span>            : #ifdef __CODEGUARD__
<span class="lineNum">     264 </span>            : # pragma option pop
<span class="lineNum">     265 </span>            : #endif
<span class="lineNum">     266 </span>            : 
<span class="lineNum">     267 </span>            : } // namespace detail
<span class="lineNum">     268 </span>            : 
<span class="lineNum">     269 </span>            : } // namespace boost
<span class="lineNum">     270 </span>            : 
<span class="lineNum">     271 </span>            : #endif  // #ifndef BOOST_SMART_PTR_DETAIL_SP_COUNTED_IMPL_HPP_INCLUDED
</pre>
      </td>
    </tr>
  </table>
  <br>

  <table width="100%" border=0 cellspacing=0 cellpadding=0>
    <tr><td class="ruler"><img src="../../../../../glass.png" width=3 height=3 alt=""></td></tr>
    <tr><td class="versionInfo">Generated by: <a href="http://ltp.sourceforge.net/coverage/lcov.php" target="_parent">LCOV version 1.12</a></td></tr>
  </table>
  <br>

</body>
</html>
